{% extends "CommonLibraryBundle::base.html.twig" %}

{% block stylesheets %}
    {{ parent() }}
    <link type="text/css" rel="stylesheet" href="{{asset("js/dataTable/DataTables-1.10.0/media/css/jquery.dataTables.css")}}" />
    <link type="text/css" rel="stylesheet" href="{{ asset("css/niveau.css") }}"/>
{% endblock %}

{% block javascripts %}
    {{parent()}}
    <script type="text/javascript" src="{{ asset("js/dataTable/DataTables-1.10.0/media/js/jquery.dataTables.js") }}"></script>{% endblock %}

{% block titre %}
    Niveau
{% endblock %}

{% block titresmall %}
    Tous les niveaux
{% endblock %}

{% block notif %}
    {% include '::notif.html.twig' %}
{% endblock %}

{% block subbody %}
    <script type="text/javascript">
        $(function () {
            $("#tableauNiveaux").dataTable({
                "language": {
                    "lengthMenu": "_MENU_ Enregistrements par page",
                    "zeroRecords": "Aucun niveau disponible",
                    "info": "Page _PAGE_ sur _PAGES_",
                    "infoEmpty": "Aucun enregistrement disponible",
                    "infoFiltered": "(filtered from _MAX_ total records)",
                    "search": "Chercher:",
                    "paginate": {
                        "next":       "Suivant",
                        "previous":   "Précédent"
                    }
                },
                "columns": [
                    { "width": "70%"},
                    { "orderable": false, "width": "15%" },
                    { "orderable": false, "width": "15%" }
                ]
            });
        });
    </script>

    <div id="divGestionNiveau">
        <a href="{{ path('common_library_niveau_edit') }}" class="btn btn-mini btn-ajout btn-primary pull-right"><span class="glyphicon glyphicon-plus"></span> Ajouter un niveau</a><br/><br/>
        <table id="tableauNiveaux" class="display table table-violet table-bordered table-striped table-responsive table-hover">
            <thead>
                <tr>
                    <th>Intitulé</th>
                    <th></th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                {% for niveau in niveaux %}
                    <tr>
                        <td>{{ niveau.intitule }}</td>
                        <td style="text-align:center;"><a href="{{ path('common_library_niveau_edit_1', {'idNiveau': niveau.id}) }}"><button class="btn btn-info btn-sm"><i class="glyphicon glyphicon-edit"></i></button></a></td>
                        <td style="text-align:center;"><a href="{{ path('common_library_niveau_delete', {'idNiveau': niveau.id}) }}" onclick="return confirm('Etes-vous sûr(e) de vouloir supprimer le niveau {{ niveau.intitule }} ?')"><button class="btn btn-danger btn-sm"><i class="glyphicon glyphicon-remove"></i></button></a></td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>

{% endblock %}